﻿using WPF.Core.Dtos;
using WPF.Core.Models;
using static WPF.Core.Dtos.NoteBookModel;
namespace WPF.Core.Services
{
    /// <summary>
    /// 记事本服务
    /// </summary>
    public class NoteBookService:BaseService<NoteBookModel,NoteBook>,INoteBookService
    {
        public async Task<List<NoteBookModel>> GetAll(NoteBookPagingInfo paging)
        {
            var model = await Sqlite.Select<NoteBook>()
                .Where(q => q.Title.Contains(paging.Name))
                .Count(out long count)
                .Page(paging.PageNumber, paging.PageSize)
                .ToListAsync();
            paging.Count = count;
            return mapper.Map<List<NoteBookModel>>(model);
        }
    }
}
